home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
ctlib100.zip
/
INSTALL.LZH
/
CONTAINR.INT
< prev
next >
Wrap
Text File
|
1996-10-12
|
6KB
|
156 lines
{**************************************************************************}
{* BitSoft Development, L.L.C. *}
{* Copyright (C) 1995, 1996 BitSoft Development, L.L.C. *}
{* All rights reserved. *}
{* Base container objects unit *}
{* Version 2.6.4 *}
{**************************************************************************}
unit Containr;
{$X+}
interface
uses Objects
{$ifdef ver60}, BsdVer60 {$endif};
const
ctOk = 0;
ctRange = -1;
ctOverflow = -2;
ctInit = -3;
ctStream = -4;
ctOutOfMemory = -5;
ctDuplicate = -6;
ctInvalidSig = -7;
ctInvalidVer = -8;
const
tctOk : Integer = ctOk;
tctRange : Integer = ctRange;
tctOverflow : Integer = ctOverflow;
tctInit : Integer = ctInit;
tctStream : Integer = ctStream;
tctOutOfMemory : Integer = ctOutOfMemory;
tctDuplicate : Integer = ctDuplicate;
tctInvalidSig : Integer = ctInvalidSig;
tctInvalidVer : Integer = ctInvalidVer;
const
ctRetry = 0;
ctAbort = -1;
const
ctTop = 1;
ctBottom = 2;
type
PContainer = ^TContainer;
TContainer = object(TObject)
Status : Integer;
Count : LongInt;
constructor Init;
constructor Load(var S: TStream);
function Delete (Item: Pointer): Boolean; virtual;
function DeleteAll : Boolean; virtual;
function DeleteAllThat (Test : Pointer) : Boolean; virtual;
procedure DoneItem (Item : Pointer); virtual;
function Error (Code : Integer; var Info) : Integer; virtual;
function ForEach (Action : Pointer) : Boolean; virtual;
function ForEachThat (Test, Action : Pointer): Boolean; virtual;
function Free (Item : Pointer) : Boolean; virtual;
function FreeAll : Boolean; virtual;
function FreeAllThat (Test : Pointer) : Boolean; virtual;
procedure FreeItem (Item : Pointer); virtual;
function GetItem (var S : TStream) : Pointer; virtual;
function Insert (Item : Pointer) : Boolean; virtual;
function Pack : Boolean; virtual;
procedure PutItem (var S : TStream; Item : Pointer); virtual;
procedure Reset; virtual;
procedure Store(var S: TStream);
function Zap : Boolean; virtual;
end; { TContainer }
type
PSequence = ^TSequence;
TSequence = object(TContainer)
FirstIndex : LongInt;
constructor Init;
constructor Load (var S: TStream);
function At (Index : LongInt) : Pointer; virtual;
function AtDelete (Index : LongInt) : Boolean; virtual;
function AtFree (Index : LongInt) : Boolean; virtual;
function AtInsert (Index : LongInt; Item : Pointer) : Boolean; virtual;
function AtPut (Index : LongInt; Item : Pointer) : Boolean; virtual;
function AtReplace(Index : LongInt; Item : Pointer) : Boolean; virtual;
function Delete (Item : Pointer) : Boolean; virtual;
function DeleteAllThat (Test: Pointer): Boolean; virtual;
function First (var Index : LongInt) : Pointer; virtual;
function FirstThat (Test : Pointer; var Index : LongInt) : Pointer;
virtual;
function ForEach (Action : Pointer) : Boolean; virtual;
function ForEachThat (Test, Action : Pointer) : Boolean; virtual;
function FreeAll : Boolean; virtual;
function FreeAllThat (Test: Pointer): Boolean; virtual;
function IndexOf (Item : Pointer) : LongInt; virtual;
function Insert (Item : Pointer) : Boolean; virtual;
function Last (var Index : LongInt) : Pointer; virtual;
function LastIndex : LongInt;
function LastThat (Test : Pointer; var Index : LongInt) : Pointer;
virtual;
function Next (var Index: LongInt) : Pointer; virtual;
function NextThat (Test : Pointer; var Index : LongInt) : Pointer;
virtual;
function OutOfRange (Index : LongInt) : Boolean; virtual;
function Prev (var Index: LongInt) : Pointer; virtual;
function PrevThat (Test : Pointer; var Index : LongInt) : Pointer;
virtual;
function Search (Key : Pointer; var Index : LongInt): Boolean; virtual;
procedure Store (var S: TStream);
end; { TSequence }
type
PGraph = ^TGraph;
TGraph = object(TContainer)
CaseSensitive : Boolean;
Duplicates : Boolean;
ExactMatch : Boolean;
constructor Init;
constructor Load(var S: TStream);
function Compare (Key1, Key2 : Pointer): Integer; virtual;
function DeleteAllThat (Test: Pointer): Boolean; virtual;
function Find (Key : Pointer; var Hits : LongInt) : Boolean; virtual;
function FindThat (Key, Test : Pointer; var Hits : LongInt) : Boolean;
virtual;
function First : Pointer; virtual;
function FirstThat (Test : Pointer) : Pointer; virtual;
function FreeAllThat (Test: Pointer): Boolean; virtual;
function ItemPut (OldItem, NewItem : Pointer) : Boolean; virtual;
function ItemReplace (OldItem, NewItem : Pointer) : Boolean; virtual;
function KeyFirst (Key : Pointer) : Pointer; virtual;
function KeyFirstThat (Test : Pointer; Key : Pointer) : Pointer; virtual;
function KeyLast (Key : Pointer) : Pointer; virtual;
function KeyLastThat (Test : Pointer; Key : Pointer) : Pointer; virtual;
function KeyOf(Item : Pointer) : Pointer; virtual;
function Last : Pointer; virtual;
function LastThat (Test : Pointer) : Pointer; virtual;
function Next (Item : Pointer) : Pointer; virtual;
function NextThat (Test : Pointer; Item : Pointer) : Pointer; virtual;
function Prev (Item : Pointer) : Pointer; virtual;
function PrevThat (Test : Pointer; Item : Pointer) : Pointer; virtual;
procedure Store(var S: TStream);
procedure Update;
end; { TGraph }
type
PNode = ^TNode;
TNode = object(TObject)
function Compare (Key : Pointer; CaseSensitive : Boolean) : ShortInt;
virtual;
function KeyOf : Pointer; virtual;
end; { TNode }
implementation
end.